<?php $this->headStyle()->captureStart()?>
    #content td { padding:5px}
    #content table { border:1px #aaa solid; padding:5px; width:100%}
    #content th {font-weight:bold;}
    #content .page a {padding:2px;}
    #content table a {cursor:pointer;}
<?php $this->headStyle()->captureEnd()?>
<form method="get" name="user_form">
    Keyword : <input type="text" name="search" id="search" value="<?php if (!empty($_GET['search'])) { echo $_GET['search']; }?>"/>
    Username: <input type="text" name="username" id="username" value="<?php if (!empty($_GET['username'])) { echo $_GET['username']; }?>"/>
    Email: <input type="text" name="email" id="email" value="<?php if (!empty($_GET['email'])) { echo $_GET['email']; }?>"/>
    <input type="submit" name="search_btn" id="search_btn" value="Search"/><br />
    get Report for <a href="<?php echo $this->geturl('index','comment', null, 'admin1', array('t'=>'today'))?>">Today</a>, 
    			   <a href="<?php echo $this->geturl('index','comment', null, 'admin1', array('t'=>'yesterday'))?>">Yesterday</a>, 
    			   <a href="<?php echo $this->geturl('index','comment', null, 'admin1', array('t'=>'last7'))?>">last 7 days</a>
    <?php if (!empty($_GET['search']) || !empty($_GET['t']) || !empty($_GET['username']) || !empty($_GET['email'])) { ?>
        <a href="<?php echo $this->geturl('index','comment', null, 'admin1')?>">View All</a>
    <?php } ?>
</form>
<table border="1">
<?php
    if (!isset($_GET['search'])) {$_GET['search'] = '';}
    $get = $_GET; unset($get['page']);
    $pagination = $this->pagination($this->listing_number, $this->page, $this->per_page, 4, $this->geturl('list', 'comment', null, 'admin1', $get));
?>
<?php if($this->list &&  $this->list->count() == 0):?>
	<tr>
		<td>
			No Comments are defined
		</td>
	</tr>
<?php else:?>
	<tr>
		<th>Status</th>
        <th>
            User Name
        </th>
        <th>
            Email
        </th>
        <th>
            Content
        </th>  
        <th>
        	Product
        </th>
        <th>
        	Complain
        </th>
        <th>
        	Operate
        </th>
   </tr>
   <?php foreach ($this->list as $val):?>
   <tr>
   		<td>
           	<?php if(Model_Util::againstBannedWords($val->content) === true || $val->status == "reactivated" || $val->status == "unpublished"):?>
           	<?php echo $val->status;?>
           	<?php else:?>
           	Suspicious
           	<?php endif;?>
   		</td>
   		<td>
   			<?php echo Model_User::find($val->user_id)->username;?>
   		</td>
   		<td>
   			<?php echo Model_User::find($val->user_id)->email;?>
   		</td>
   		<td>
   			<?php echo Model_Comment::addface($val->content);?>
   		</td>		
   		<td>
   			<a href='<?php echo Model_Listing::find($val->list_id)->url(false, null, null);?>'><?php echo Model_Listing::find($val->list_id)->title;?></a>
   		</td>
   		<td>
   			<a href="<?php echo $this->geturl('showcomplain', 'comment', null, 'admin1', array('id'=>$val->_id));?>">show(<?php echo Model_Complain::all(array('comment_id'=>$val->_id))->count();?>)</a>
   		</td>
   		<td>
   			<a href="<?php echo $this->geturl('display', 'comment', null, 'admin1', array('id'=>$val->_id))?>">Edit</a>
   			&nbsp;&nbsp;&nbsp;&nbsp;
   			<a href="<?php echo $this->geturl('changestatus', 'comment', null, 'admin1', array('id'=>$val->_id, 'status'=>'reactivated'))?>">Active</a>
   			&nbsp;&nbsp;&nbsp;&nbsp;
   			<a href="<?php echo $this->geturl('changestatus', 'comment', null, 'admin1', array('id'=>$val->_id, 'status'=>'unpublished'))?>">Unpublish</a>
   		</td>
   </tr>
   <?php endforeach;?>
<?php endif;?>
</table>
<?php echo $pagination;?>